Feature fit all - #604
Draft
PILIPALA030 wants to merge 7 commits into
Draft
Conversation
- Add ZoomToFit() to GLCanvas3D that prioritizes selection, then volumes, then bed depending on context - Render a Fit Camera icon button next to the 3D navigator in the viewport via ImGui (light/dark/hover variants) - Bind 'Z' key as global shortcut for fit camera, with guard against text entry focus, running gizmos, and ImGui keyboard capture - Add Fit Camera entry to the View menu - Add 4 fit_camera SVG icons and register them in GLGizmosManager icon textures - Fix init_icon_textures() to skip reloading if already initialized - Document 'Z' shortcut in KBShortcutsDialog - Add zh_CN translations for the new UI strings
Add Model::InitializeAssemblyPositions() to place newly imported objects sequentially along the X-axis with 10mm spacing, matching BambuStudio's assembly view behavior. Multiple instances of the same object stack along the Y-axis. All objects are auto-grounded on Z-axis. Apply assembly position initialization to all object creation paths: - Handy model insertion (GUI_Factories) - Internal mesh loading (GUI_ObjectList) - File import for raw geometry formats: STL/OBJ/GLB/GLTF/FBX (Plater) - Copy/paste (Selection) - Text emboss job (EmbossJob) - Fill bed job (FillBedJob) 3MF project files are intentionally excluded as they preserve their own position data.
Consolidate three duplicate i18n strings ("Fit camera to scene or
selected object.", "Fit Camera", "Camera view - Fit to scene or
selection") into a single "Fit in all view" label, used consistently
across tooltip, shortcut dialog, and menu item.
- perf: batch InitializeAssemblyPositions in FillBedJob::finalize (was per-item in the setter -> O(N^2) full-scene traversal) - fix: iterate loaded objects forward so assembly-view order matches load order (was reversed via rbegin/rend) at all three call sites - refactor: drop _L() on the Fit Camera ImGui window ID (hidden by NoTitleBar, polluted the translation catalog); use a plain std::string ID, also resolving begin() overload ambiguity
Kenshin627
reviewed
Jul 23, 2026
Kenshin627
reviewed
Jul 23, 2026
Kenshin627
reviewed
Jul 23, 2026
Kenshin627
reviewed
Jul 23, 2026
A single invalid object (empty mesh, null/duplicate instance, etc.) previously made InitializeAssemblyPositions return false and leave the whole batch uninitialized. Rework it to skip invalid items and continue with the valid ones. - Return void instead of bool; no caller used the result. - Skip null/undefined-mesh objects and null/undefined-box instances instead of aborting the batch. - Pre-size instanceBoxes and keep them index-aligned with instances; skipped slots stay defined==false and are filtered consistently. - Use a firstValidInstance flag instead of instanceIndex == 0 so Y stacking is correct when instances[0] is null or degenerate. - Bind rawBox to raw_mesh_bounding_box()'s cached const reference.
Registering the bare "Z" as a menu keyEquivalent on macOS would route the shortcut through the menu's wxCommandEvent, which only checks can_change_view() and bypasses the stricter ShouldSkipFitCameraShortcut guard (text-entry focus / ImGui wants keyboard / gizmo running) used in the wxEVT_CHAR_HOOK handler. On macOS the shortcut is therefore left to the CharHook path only, and the menu label omits the "\tZ" accelerator. Windows/Linux keep showing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Screenshots/Recordings/Graphs
Tests